<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src='../../angular-1.5.8/angular.js'></script>
</head>
<body>
    <div ng-app="mainApp" ng-controller='mainController'>
        用户名<input type="text" ng-model="name">
        密码<input type="password" ng-model="password">
        <button ng-click="func()">点击</button>
        <div>{{message}}</div>
    </div> 
</body>
<script>
    angular.module('mainApp',[])
        .controller('mainController',function ($scope){
            $scope.func=function (){
                var name=$scope.name,
                    password =$scope.password;
            $scope.message=
            (name&&name.trim().length>0)&&(password&&password.trim().length>0)
            ?'登录成功'
            :'填写完整信息';
            }
        })
</script>
</html>